<?php

namespace App\Modules\LuckDraw\UserTag;

use App\Modules\LuckDraw\Models\LuckDrawModel;
use App\Modules\LuckDraw\Models\UserTagModel;
use App\Modules\LuckDraw\Lib\StrLib;

class UserTagFactory {
    //获取一个奖品实例
    public static function get(int $luckId,int $userId, string $tagName, object $strategyPool) : ?UserTagInterface {
        if (empty($userId) || empty($tagName) || empty($strategyPool)) {
            return null;
        }
        $className = __NAMESPACE__ . '\\' . StrLib::camelize($tagName) . 'UserTag';
        if(class_exists($className)){
            return new $className($luckId, $userId, $strategyPool);
        }
        return null;
    }
}
